<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access'); 

ini_set('max_execution_time', 60*15);
//@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);

?>
<head>
<script>
function scroll_iframe() {
	
		window.scrollBy(0,1000);
		
		var x,y;
		if (self.pageYOffset) // all except Explorer
		{
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		document.getElementById('status').style.top=y+'px';
		document.getElementById('status').style.left='0px';		
	}
	
	my_interval = setInterval ( 'scroll_iframe()', 500 );
	
	</script>
</head>

<body  onload="setTimeout('clearInterval(my_interval)', 2000); document.getElementById('status').style.visibility == 'hidden';">
<div id='status' style="position: absolute; left:0px; top:0px; background-color:red; color: white; font-weight: bold; font-size: 12pt;">
<?php echo JText::_("IMPORTING");?>...
</div>
<pre>
<?php

$feed_id = (int) $this->data->FeedID;

$importer = new xmlFeedImporter($feed_id);
if ($importer->feed_row['Method'] != 'POST') {	
	$importer->verbose=true;
	$importer->import();
	
	echo "<script language='javascript'>document.getElementById('status').style.visibility = 'hidden'; </script> Done.\n";
	
	// Update status:
	$db =& JFactory::getDBO();
	$db->setQuery("UPDATE #__ja_xml_import_feeds SET Status = 'DONE' WHERE FeedID = '{$feed_id}'");
	$db->query();
}

?>
</pre>
</body>